package com.sikulifang.bank.simulation.controller;

import com.sikulifang.bank.simulation.dto.FlowingWaterDTO;
import com.sikulifang.bank.simulation.service.IDetailService;
import com.sikulifang.bank.simulation.util.R;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * ClassName DetailController
 * Description 明细
 *
 * @author Yat
 * Date 2023/6/8 17:30
 * version 1.0
 */
@Slf4j
@RestController
@RequestMapping("/api/detail")
public class DetailController extends AbstractController<IDetailService> {

    @SneakyThrows
    @PostMapping("/receipt")
    public R<String> createPdf(@RequestBody List<String> ids) {
        if (!ids.isEmpty()) {
            service.createPdf(ids);
        }
        return R.ok();
    }


    /**
     * 批量添加流水
     */
    @PostMapping("/batch/add")
    public R<String> batchAdd(@RequestBody FlowingWaterDTO flowingWater) {
        service.batchAdd(flowingWater);
        return R.ok();
    }
}
